package com.sleepingcat.flutter_boost_android

import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.cat.android.lib_base.ext.logD

/**
 * @作者 志浩
 * @时间 2025/2/28 21:56
 * @描述 TODO
 */
class App : Application() {
    private val TAG = "CatApp"

    override fun onCreate() {
        super.onCreate()
        listenActivity()
    }

    private fun listenActivity() {
        registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
            override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
            }

            override fun onActivityStarted(activity: Activity) {
            }

            override fun onActivityResumed(activity: Activity) {
                "onActivityResumed - ${activity.javaClass.simpleName} - $activity".logD(tag = TAG)
            }

            override fun onActivityPaused(activity: Activity) {
            }

            override fun onActivityStopped(activity: Activity) {
            }

            override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
            }

            override fun onActivityDestroyed(activity: Activity) {
                "onActivityDestroyed - ${activity.javaClass.simpleName} - $activity".logD(tag = TAG)
            }

        })
    }
}